//astar_getpath(startx,starty,endx,endy)
var ar0,ar1,ar2,ar3,pathstring,path,l,num1,num2,done;
ar0=floor(argument0/global.astarR_cellwidth)
ar1=floor(argument1/global.astarR_cellheight)
ar2=floor(argument2/global.astarR_cellwidth)
ar3=floor(argument3/global.astarR_cellheight)
pathstring=external_call(global.astarR_getpath,ar0,ar1,ar2,ar3)
path=true
if pathstring!=''{
pathstring=string_replace_all(pathstring,"a(",")a(");
pathstring=string_replace_all(pathstring,"e(","a(");
pathstring=string_replace_all(pathstring,"b(",")e(");
global.astarR_path=path_add()
l = string_length(pathstring)
for (var i = 1;i<=l;i+=1)
    {
    if (string_char_at(pathstring,i) = 'a') and (string_char_at(pathstring,i+1) = '(')
        {
        num1 = ''
        num2 = ''
        done = false
        pos = 2
        while(done = false)
            {
            if string_char_at(pathstring,i+pos) != ','
                {
                //num1 = string_insert(string_char_at(pathstring,i+pos),num1,string_length(num1)+1)
                num1 += string_char_at(pathstring,i+pos)
                pos+=1
                }
            else
                {
                done = true
                pos+=1
                }
            }
        done = false
        while(done = false)
            {
            if string_char_at(pathstring,i+pos) != ')'
                {
                //num2 = string_insert(string_char_at(pathstring,i+pos),num2,string_length(num2))
                num2 += string_char_at(pathstring,i+pos)
                pos+=1
                }
            else
                {
                done = true
                //pos+=1
                }
            }
        //show_debug_message('astar_addpoint(' + num1 +','+ num2 +')')
        astar_addpoint(real(num1),real(num2))
        i+=pos
        }
    if string_char_at(pathstring,i) = 'e'
        {astar_endpath()
        //show_debug_message('astar_endpath()')
        }
    }
//show_debug_message(pathstring)
//execute_string(pathstring)}else{path=false}
/*if path=true{*/return(global.astarR_path)}//;}else{return('')}
